function replaceEnterText(text) {
    return text.replace(/\n/g, "").replace(/\s/g, "");
}
/**
 * 遍历迭代器，可设置迭代间隔时间
 * 
 * @param {Array} arr 
 * @param {Function} fn callback
 * @param {Number} time 单位为秒 S
 * @returns 
 */
async function asyncEach(arr, fn, time) {
    if (Object.prototype.toString.call(arr).indexOf('Array') == -1) {
        return null;
    }
    if (!time) {
        time = 0;
    }

    function waitTime(time) {
        return new Promise((resolve, reject) => {
            setTimeout(resolve, time);
        })
    }
    for (let [index, elem] of arr.entries()) {
        await waitTime(time);
        fn(index, elem);
    }

}
module.exports = {
    replaceEnterText,
    asyncEach
}